﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExtensionsLib.Dictionary
{
    public static class DictionaryExtensionsRemove
    {

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TValue"></typeparam>
        /// <param name="self"></param>
        /// <param name="condition"></param>
        public static void Remove<TKey, TValue>(this Dictionary<TKey, TValue> self, Func<KeyValuePair<TKey, TValue>, bool> condition)
        {
            foreach (var item in self.Where(condition).ToList())
            {
                self.Remove(item.Key);
            }
        }

    }
}
